import vue from 'vue'

function capitalizeFirstLetter(String) {
  return String.charAt(0).toUpperCase() + String.slice(1)
}
const requireComponent = require.context(
  '.',true,/\.vue$/
)
requireComponent.keys().forEach(fileName=>{
  const componetsConfig = requireComponent(fileName);
  const componentName = capitalizeFirstLetter(
    fileName.split('/').pop()
      .replace(/\.\w+$/,'')
  )
  vue.component(componentName,componetsConfig.default || componetsConfig)
})
